﻿using UnityEngine;
using System.Collections;
namespace net{
	public class exitToMainMeun : MonoBehaviour {

		// Use this for initialization
		void Start () {
		
		}
		
		// Update is called once per frame
		void Update () {

		
			if ((Application.platform == RuntimePlatform.Android && Input.GetKeyDown(KeyCode.Escape)) || Input.GetKeyDown(KeyCode.Escape)) {
				if(Network.peerType==NetworkPeerType.Server){
					networkView.RPC("networkLoadlv", RPCMode.All, "connect");
				}
				else{
				Network.Disconnect();
					Application.LoadLevel(0);
				}
			}
		}

		[RPC]
		public void networkLoadlv(string levelName){
			Application.LoadLevel(levelName);
		}
	}


}